package com.zl.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * 控制类
 * @ClassName: HelloController
 * @author: suke
 * @since: 2021/8/4 9:39
 */
@Controller
public class HelloController {

    // method 默认 处理get/post都行
    @RequestMapping(value="/sayHello",method= RequestMethod.POST)
    public ModelAndView  sayHello(String name, Integer age){
        ModelAndView modelAndView = new ModelAndView();
        System.out.println(name+"--"+age);
        modelAndView.addObject("msg","hello:"+name+age);
        modelAndView.setViewName("hello");
        return modelAndView;
    }
}
